Repository navigation
fix(id): invite names refuse control and format characters (#1770) - #3759
Merged
Merged
Conversation
Invite::new now rejects category Cc (char::is_control) and category Cf characters on the raw name, before trimming, so an edge tab/newline/CR is refused rather than trimmed away and an embedded control or invisible format character cannot ride the invite onto the /invite trust prompt or into the prefilled petname. The Cf set is petname's existing is_format_char predicate (Unicode 16), now pub(crate) and shared instead of duplicated; ordinary spaces keep the long-standing trim. parse/from_query inherit the refusal through Invite::new, including percent-encoded controls. Tests: direct Cc embedded/edge cases, representative Cf (soft hyphen, ZWSP, bidi override, BOM, tag char), percent-encoded tab/newline/CR/Cf through both from_query and parse, and space-trimming preserved. Local cargo test could not run in the laptop environment (lib-test target fails identically on clean main under default features; all-features additionally needs the nix-built web/dist) — verification is via the PR's nix checks per the fleet CI-first rule.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1770 (queue task 4799; policy pinned by triage task 1998).
What changed
pkgs/id/src/invite.rs—Invite::newnow refuses a name carrying a control character (Unicode Cc, viachar::is_control) or a format character (Unicode Cf) anywhere in the raw name, checked before trimming: an edge tab/newline/CR is refused rather than trimmed away, and embedded controls or invisible format characters can no longer ride an invite onto the/invitetrust prompt or into the prefilled petname. Ordinary spaces keep the long-standing trim behaviour.parse/from_queryinherit the refusal throughInvite::new, including percent-encoded controls (%09,%0A,%0D, …).pkgs/id/src/petname.rs— the existing full-Cf predicateis_format_char(Unicode 16 ranges, from the id(petname): format characters (Cf) bypass both petname guards — U+200B makes a spoof of another contact's name, U+202E passes the 'no control characters' rule #1674 petname work) is nowpub(crate)so the invite boundary refuses exactly the same set instead of duplicating the ranges.Tests
New tests in
invite.rs: direct Cc embedded and at both edges (tab, newline, CR, BEL, VT); representative Cf (soft hyphen U+00AD, zero-width space U+200B, bidi override U+202E, U+FEFF, a tag character); percent-encoded tab/newline/CR and Cf (U+200B, U+00AD) through bothfrom_queryandparse; and a positive test that ordinary spaces still trim (direct and+-as-space). Existing round-trip, plus-as-space, invalid-key and length behaviour is untouched.Verification note
Local
cargo testcould not run in the laptop environment: the lib-test target fails to compile identically on cleanmainunder default features (clap derive attributes insrc/cli.rs— verified by stashing this change and re-running), and--all-featuresadditionally requires the nix-builtweb/distfor RustEmbed. Per the fleet's CI-first rule, verification for this PR is the nix check suite (test-unit / test shards) on this PR; the change itself is two small, self-contained edits plus tests.Need help on this PR? Tag
@codesmith-botwith what you need.